package com.katian.analyse.picking;

import java.text.ParseException;
import java.util.Date;

/**
 * User: csavard
 * Date: 13-06-03
 */
public class Commande implements Comparable<Commande> {
    private long noCommande;
    private CommandeFacturee commandeFacturee;
    private CommandeVendue commandeVendue;

    public long getNoCommande() {
        return noCommande;
    }

    public void setNoCommande(long noCommande) {
        this.noCommande = noCommande;
    }

    public CommandeFacturee getCommandeFacturee() {
        return commandeFacturee;
    }

    public void setCommandeFacturee(CommandeFacturee commandeFacturee) {
        this.commandeFacturee = commandeFacturee;
    }

    public CommandeVendue getCommandeVendue() {
        return commandeVendue;
    }

    public void setCommandeVendue(CommandeVendue commandeVendue) {
        this.commandeVendue = commandeVendue;
    }


    public Date getDate() throws ParseException {
        Date date = null;
        if (commandeVendue != null) {
            date = commandeVendue.getDate();
        }
        return date;
    }

    public String getNomDetaillant() {
        String nom = null;
        if (commandeVendue != null) {
            nom = commandeVendue.getNomDetaillant();
        }
        return nom;
    }

    public int getCaisseFacturee() {
        int caisses = -1;
        if (commandeFacturee != null) {
            caisses = commandeFacturee.getCaisses();
        }
        return caisses;
    }

    public int getCaisseVendues() {
        int caisses = -1;
        if (commandeVendue != null) {
            caisses = commandeVendue.getCaisses();
        }
        return caisses;
    }

    @Override
    public int compareTo(Commande o) {
        return ((Long) noCommande).compareTo(o.getNoCommande());
    }
}
